package com.santu.edu.supporter.biz.order.common.service.impl;

import com.santu.edu.supporter.biz.order.common.pojo.enums.OrderStatusEnum;
import com.santu.edu.supporter.biz.order.common.pojo.enums.OrderTypeEnum;
import com.santu.edu.supporter.biz.order.common.service.OrderCommonService;
import com.santu.edu.supporter.biz.order.helpbuy.service.HelpBuyService;
import com.santu.edu.supporter.biz.order.kd.dao.KuaidiOrderDao;
import com.santu.edu.supporter.biz.order.kd.service.KuaidiService;
import com.santu.edu.supporter.biz.order.other.service.OtherOrderService;
import com.santu.edu.supporter.biz.order.wm.service.WmOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author luoyaoqi
 * @createTime 2024/2/29
 * @description
 */
@Service
@RequiredArgsConstructor
public class OrderCommonServiceImpl implements OrderCommonService {

    private final KuaidiOrderDao kdOrderDao;

    private final WmOrderService wmOrderService;

    private final HelpBuyService helpBuyService;

    private final OtherOrderService otherOrderService;


    @Override
    public void updateOrderPayStatus(String orderId, OrderTypeEnum orderType, OrderStatusEnum orderStatus) {
        switch (orderType) {
            case KUAI_DI:
                kdOrderDao.updateOrderStatus(orderId, orderStatus,OrderStatusEnum.TO_BE_PAID);
            case WAI_MAI:
                wmOrderService.updateOrderStatus(orderId, orderStatus,OrderStatusEnum.TO_BE_PAID);
                break;
            case HELP_BAY:
                helpBuyService.updateOrderStatus(orderId, orderStatus,OrderStatusEnum.TO_BE_PAID);
                break;
            case OTHER:
                otherOrderService.updateOrderStatus(orderId, orderStatus,OrderStatusEnum.TO_BE_PAID);
                break;
            default:
                break;
        }
    }


}
